//
//  LCNavigationVC.m
//  LongChain
//
//  Created by FengZi on 2018/4/22.
//  Copyright © 2018年 FengZi. All rights reserved.
//

#import "LCNavigationVC.h"

@interface LCNavigationVC ()<UIGestureRecognizerDelegate>

@end

@implementation LCNavigationVC

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    [self customNavigation];
    self.navigationBar.translucent = YES;
    NSInteger selectedIndex = self.tabBarController.selectedIndex;
    LCLog(@"%ld",(long)selectedIndex);
    switch (selectedIndex) {
        case 0:
        {
            [self.tabBarItem setSelectedImage:[[UIImage imageNamed:@"cloudPlatesSelected"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];//选中图片
            
        }
            break;
        case 1:
        {
            
        }
            break;
        case 2:
        {
            [self.tabBarItem setSelectedImage:[[UIImage imageNamed:@"mineSelected"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];//选中图片
            
        }
            break;
            
        default:
            break;
    }
    self.interactivePopGestureRecognizer.delegate = self;



}

- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer{
    
    return (self.viewControllers.count > 1);
    
}
- (void)customNavigation {
    
    UIImage *image = [UIImage imageNamed:@"navBackground"];

    UINavigationBar *navigationBar = [UINavigationBar appearance];
    navigationBar.backIndicatorImage = [UIImage imageNamed:@"home_ic_back_n"];
    navigationBar.backIndicatorTransitionMaskImage = [UIImage imageNamed:@"home_ic_back_n"];
    navigationBar.barTintColor = [UIColor colorWithRed:238/255.0 green:91/255.0 blue:73/255.0 alpha:1.0];

    [navigationBar setBackgroundImage:image forBarMetrics:UIBarMetricsDefault];
    navigationBar.shadowImage = [UIImage new];

}

- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated {
    viewController.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStyleDone target:nil action:nil];
    
    if (self.viewControllers.count) {
        viewController.hidesBottomBarWhenPushed = YES;
    }
    [super pushViewController:viewController animated:animated];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
